<template>
  <div class="wfull">
    <a-form :labelCol="{ span: 4 }" :wrapperCol="{ span: 20 }">
      <a-form-item label="图标">
        <ZgInput :width="200" v-model="icon"></ZgInput><a-icon :type="icon"/>
      </a-form-item>
      <a-form-item label="名称" required>
        <ZgInput v-model="name"></ZgInput>
      </a-form-item>
      <a-form-item label="编码" required>
        <ZgInput v-model="code"></ZgInput>
      </a-form-item>
      <a-form-item label="状态" required>
        <ZgSwitch v-model="isUse"></ZgSwitch>
      </a-form-item>
    </a-form>
  </div>
</template>
<script>
export default {
  props: {
    pid: {
      type: String,
      default: null
    },
    layer: {
      type: Number,
      default: 1
    }
  },
  data () {
    return {
      icon: '',
      name: '',
      code: '',
      isUse: true
    }
  },
  methods: {
    save () {
      if (this.name.length === 0) {
        return this.$result.error('请输入名称')
      }
      if (this.code.length === 0) {
        return this.$result.error('请输入编码')
      }

      return this.$result.ok({
        pid: this.pid,
        icon: this.icon,
        name: this.name,
        code: this.code,
        layer: this.layer,
        isUse: this.isUse
      })
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
